﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShivamEMR.Model.Domain;
using ShivamEMR.Model.Domain.ContactsDomain;
using ShivamEMR.Model.Domain.CompanyDomain;
using ShivamEMR.Model.Domain.LocationDomain;
using System.ComponentModel.DataAnnotations;

namespace ShivamEMR.Model.Domain.CRMDomain
{
   public class Venue
    {
        #region Properties
        public Guid ID { get; set; }
        public string VenueType { get; set; }
        public string Notes { get; set; } 
        #endregion

        #region ForeignKeyProperties
        public Nullable< int> BranchID { get; set; }
        public Nullable<Guid> ContactID { get; set; }
        public Nullable<Guid> AddressID { get; set; }
        public Nullable<Guid> LocationID { get; set; } 
        #endregion

        #region NavigationalProperties
       [ForeignKey("BranchID")]
        public virtual Branch Branch { get; set; }
        [ForeignKey("ContactID")]
        public virtual Contact Contact { get; set; }
        [ForeignKey("AddressID")]
        public virtual Address Address { get; set; }
        [ForeignKey("LocationID")]
        public virtual Location Location { get; set; }

        public virtual ICollection<Appointment> Appointments { get; set; }
        public virtual ICollection<Assignment> Assignments { get; set; }
        public virtual ICollection<Interaction> Interactions { get; set; }
        #endregion

       [NotMapped]
        public string Title
        {
            get
            {
                string str = string.Empty;
                if (BranchID != null)
                    str = Branch.Name;
                else if (ContactID != null)
                    str = Contact.Value;
                //else if (AddressID != null)
                //    str = Address.Title;
                else if (LocationID != null)
                    str = Location.Name;
                return str;
            }
        }

    }
}
